/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "clientes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Clientes.findAll", query = "SELECT c FROM Clientes c"),
    @NamedQuery(name = "Clientes.findByIdCliente", query = "SELECT c FROM Clientes c WHERE c.idCliente = :idCliente"),
    @NamedQuery(name = "Clientes.findByNombreCliente", query = "SELECT c FROM Clientes c WHERE c.nombreCliente = :nombreCliente")})
public class Clientes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_cliente")
    private Integer idCliente;
    @Size(max = 100)
    @Column(name = "nombre_cliente")
    private String nombreCliente;
    @ManyToMany(mappedBy = "clientesCollection")
    private Collection<Ventas> ventasCollection;
    @ManyToMany(mappedBy = "clientesCollection")
    private Collection<Usuarios> usuariosCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "clientesIdCliente")
    private Collection<Cotizacion> cotizacionCollection;
    @JoinColumn(name = "tipos_id_id_tipo_id", referencedColumnName = "id_tipo_id")
    @ManyToOne(optional = false)
    private TiposId tiposIdIdTipoId;
    @JoinColumn(name = "id_tipo_cliente", referencedColumnName = "id_tipo_cliente")
    @ManyToOne(optional = false)
    private TiposCliente idTipoCliente;
    @JoinColumn(name = "pais_id_pais", referencedColumnName = "id_pais")
    @ManyToOne(optional = false)
    private Paises paisIdPais;

    public Clientes() {
    }

    public Clientes(Integer idCliente) {
        this.idCliente = idCliente;
    }

    public Integer getIdCliente() {
        return idCliente;
    }

    public void setIdCliente(Integer idCliente) {
        this.idCliente = idCliente;
    }

    public String getNombreCliente() {
        return nombreCliente;
    }

    public void setNombreCliente(String nombreCliente) {
        this.nombreCliente = nombreCliente;
    }

    @XmlTransient
    public Collection<Ventas> getVentasCollection() {
        return ventasCollection;
    }

    public void setVentasCollection(Collection<Ventas> ventasCollection) {
        this.ventasCollection = ventasCollection;
    }

    @XmlTransient
    public Collection<Usuarios> getUsuariosCollection() {
        return usuariosCollection;
    }

    public void setUsuariosCollection(Collection<Usuarios> usuariosCollection) {
        this.usuariosCollection = usuariosCollection;
    }

    @XmlTransient
    public Collection<Cotizacion> getCotizacionCollection() {
        return cotizacionCollection;
    }

    public void setCotizacionCollection(Collection<Cotizacion> cotizacionCollection) {
        this.cotizacionCollection = cotizacionCollection;
    }

    public TiposId getTiposIdIdTipoId() {
        return tiposIdIdTipoId;
    }

    public void setTiposIdIdTipoId(TiposId tiposIdIdTipoId) {
        this.tiposIdIdTipoId = tiposIdIdTipoId;
    }

    public TiposCliente getIdTipoCliente() {
        return idTipoCliente;
    }

    public void setIdTipoCliente(TiposCliente idTipoCliente) {
        this.idTipoCliente = idTipoCliente;
    }

    public Paises getPaisIdPais() {
        return paisIdPais;
    }

    public void setPaisIdPais(Paises paisIdPais) {
        this.paisIdPais = paisIdPais;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCliente != null ? idCliente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Clientes)) {
            return false;
        }
        Clientes other = (Clientes) object;
        if ((this.idCliente == null && other.idCliente != null) || (this.idCliente != null && !this.idCliente.equals(other.idCliente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Clientes[ idCliente=" + idCliente + " ]";
    }
    
}
